<%

Dim TI_ID			
Dim TI_Type			
Dim TI_Title		
Dim TI_Pic			
Dim TI_Detail		
Dim TI_Fee			

Dim TI_Tel			
Dim TI_Address		

Dim TI_Remark		

Dim Update_Name
Dim Update_Date

Dim Action
Dim Info_ID
Sub Get_Traffic_Info_Data()

	TI_ID		= reform("TI_ID")		
	TI_Type		= reform("TI_Type")		
	TI_Title	= reform("TI_Title")		
	TI_Pic		= reform("TI_Pic")		
	TI_Detail	= reform("TI_Detail")		
	TI_Fee		= reform("TI_Fee")		

	TI_Tel		= reform("TI_Tel")		
	TI_Address	= reform("TI_Address")		

	TI_Remark	= reform("TI_Remark")		

	Update_Name		= Session("Admin_UserName")
	Update_Date		= now()
	
End Sub 
Sub Traffic_Info_Action()
	Info_ID = Get_ID("Info_ID")
	If Info_ID=0 Then 
		Call Traffic_Info_Add()
	Else
		Call Traffic_Info_Edit()
	End If 
End Sub 
Sub Traffic_Info_Add()	
	

	Call Get_Traffic_Info_Data()

	sql = "INSERT INTO Traffic_Info( " &_

		" TI_Type"&_

		",TI_Title"&_		
		",TI_Pic"&_
		",TI_Detail"&_
		",TI_Fee"&_

		",TI_Tel"&_
		",TI_Address"&_

		",TI_Remark"&_

		",Update_Name"&_
		",Update_Date"&_

		") VALUES( " &_

		" '"&TI_Type&"'"&_

		",'"&TI_Title&"'"&_
		",'"&TI_Pic&"'"&_
		",'"&TI_Detail&"'"&_
		",'"&TI_Fee&"'"&_

		",'"&TI_Tel&"'"&_
		",'"&TI_Address&"'"&_

		",'"&TI_Remark&"'"&_

		",'"&Update_Name&"'"&_
		",'"&Update_Date&"'"&_
		")"


    conn.execute(sql)


	'Session("IT_ID") = IT_ID

	AlertBox "交通信息增加成功！","Traffic_Info_Query.asp"


End Sub

Sub Traffic_Info_Edit()	


	Call Get_Traffic_Info_Data()
	Info_ID = Reform("Info_ID")
	Call Check_IsNumeric(Info_ID)

	sql = "UPDATE Traffic_Info Set " &_
		  "TI_Type ='"&TI_Type&"'"&_

		  ",TI_Title ='"&TI_Title&"'"&_		  
		  ",TI_Pic ='"&TI_Pic&"'"&_
		  ",TI_Detail ='"&TI_Detail&"'"&_
		  ",TI_Fee ='"&TI_Fee&"'"&_

		  ",TI_Tel ='"&TI_Tel&"'"&_
		  ",TI_Address ='"&TI_Address&"'"&_

		  ",TI_Remark ='"&TI_Remark&"'"&_

		  ",Update_Name ='"&Update_Name&"'"&_
		  ",Update_Date ='"&Update_Date&"'"&_

		  " WHERE TI_ID = "&Info_ID

    conn.execute(sql)

	AlertBox "交通信息修改成功！","Traffic_Info_Query.asp"

End Sub

Sub Traffic_Info_Del()

	Info_ID = Reform("OP_ID")

	sql = "DELETE FROM  Traffic_Info WHERE TI_ID IN ( "&Info_ID &")"

    conn.execute(sql)

	AlertBox "交通信息删除成功！","Traffic_Info_Query.asp"
	
End Sub

Sub Get_Traffic_Info(ID)

	Info_ID = Get_ID(ID)
	If Info_ID=0 Then 
		Action = "增加"
		Exit Sub 
	End If 

	Sql = "SELECT * FROM Traffic_Info WHERE TI_ID="&Info_ID


	Set rs = conn.execute(sql)
	
	If Not rs.eof Then
		TI_Type		= rs("TI_Type")	
		TI_Title	= rs("TI_Title")	
		TI_Pic		= rs("TI_Pic")	
		TI_Detail	= rs("TI_Detail")	
		TI_Fee		= rs("TI_Fee")	

		TI_Tel		= rs("TI_Tel")	
		TI_Address	= rs("TI_Address")	

		TI_Remark	= rs("TI_Remark")	

					   
		Update_Name    = rs("Update_Name")
		Update_Date    = rs("Update_Date")

	End If

	Action="修改"
End Sub 
Function Get_ID(Info_ID)
	If Request.ServerVariables ("Request_Method")="POST" Then
		ID = reform(Info_ID)
	Else
		ID = requery(Info_ID)
	End If 
	If IsNumeric(ID)=False Then 
		Get_ID = 0
	Else
		Get_ID = ID
	End If 
End Function 
%>


